//
//  LotteryPredictDetailVC.m
//  DaleTou
//
//  Created by candyxj on 2018/5/28.
//  Copyright © 2018年 geren. All rights reserved.
//

#import "LotteryPredictDetailVC.h"
#import "Appearance.h"
#import "MYLabel.h"

@interface LotteryPredictDetailVC ()

//@property (nonatomic , strong ) UITextView *textView;

@property ( nonatomic , strong ) UIScrollView *myScrollView;
@property( nonatomic , strong ) UILabel *titleLb;
@property( nonatomic , strong ) UILabel *dateLb;
@property( nonatomic , strong ) UIButton *suportBtn;
@property( nonatomic , strong ) MYLabel *contentLb;


@end

@implementation LotteryPredictDetailVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor colorWithHexString:@"ffffff"];
    [self setNavConfigStartColor:@"#F57321" endColor:@"#F57321"];
    [self ApptitileView:@"预测详情"];
    
    [self.view addSubview:self.myScrollView];
    [self.myScrollView addSubview:self.titleLb];
    [self.myScrollView addSubview:self.dateLb];
    [self.myScrollView addSubview:self.suportBtn];
    [self.myScrollView addSubview:self.contentLb];
        
    self.contentLb.text = [NSString stringWithFormat:@"%@",_dataDic[@"content"]];
    
    CGRect tmpRect = [self.contentLb.text boundingRectWithSize:CGSizeMake(self.contentLb.frame.size.width, 1000) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:14],NSFontAttributeName, nil] context:nil];
    
    self.contentLb.frame = CGRectMake(CGRectGetMinX(self.dateLb.frame), CGRectGetMaxY(self.suportBtn.frame) + 15, Main_Screen_Width - 30, tmpRect.size.height);
    self.myScrollView.contentSize = CGSizeMake(0, tmpRect.size.height + 94);
    
}

-(UIScrollView *)myScrollView{
    
    if ( !_myScrollView) {
        _myScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, NAVIGATION_BAR_HEIGHT, Main_Screen_Width, Main_Screen_Height - NAVIGATION_BAR_HEIGHT)];
        
    }
    return _myScrollView;
}



-(UILabel *)titleLb{
    
    if ( !_titleLb) {
        
        _titleLb = [[UILabel alloc] initWithFrame:CGRectMake(0, 10, Main_Screen_Width, 30)];
        _titleLb.textColor = UIColor.blackColor;
        _titleLb.textAlignment = NSTextAlignmentCenter;
        _titleLb.font = [UIFont systemFontOfSize:14];
        _titleLb.text = [NSString stringWithFormat:@"%@",_dataDic[@"title"]];
    }
    return _titleLb;
}

-(UILabel *)dateLb{
    
    if ( !_dateLb) {
        
        _dateLb = [[UILabel alloc] initWithFrame:CGRectMake(15, CGRectGetMaxY(self.titleLb.frame) + 15, 150, 20)];
        _dateLb.textColor = UIColor.grayColor;
        _dateLb.textAlignment = NSTextAlignmentLeft;
        _dateLb.font = [UIFont systemFontOfSize:12];
        _dateLb.text = [NSString stringWithFormat:@"%@",_dataDic[@"date"]];
    }
    return _dateLb;
}


-(UIButton *)suportBtn{
    
    if ( !_suportBtn) {
        
        _suportBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _suportBtn.frame = CGRectMake(Main_Screen_Width - 120 - 15, CGRectGetMinY(self.dateLb.frame), 120, CGRectGetHeight(self.dateLb.frame));
        [_suportBtn setImage:[UIImage imageNamed:@"点赞"] forState:UIControlStateNormal];
        [_suportBtn setTitle:[NSString stringWithFormat:@"%@",_dataDic[@"num"]] forState:UIControlStateNormal];
        [_suportBtn setTitleColor:UIColor.grayColor forState:UIControlStateNormal];
        _suportBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
        _suportBtn.titleLabel.font = [UIFont systemFontOfSize:12];
    }
    return _suportBtn;
}


-(MYLabel *)contentLb{
    
    if ( !_contentLb) {
        
        _contentLb = [[MYLabel alloc] initWithFrame:CGRectMake(CGRectGetMinX(self.dateLb.frame), CGRectGetMaxY(self.suportBtn.frame) + 15, Main_Screen_Width - 30, CGRectGetHeight(self.myScrollView.frame) - 80)];
        _contentLb.textColor = UIColor.grayColor;
        _contentLb.numberOfLines = 0;
        [_contentLb setVerticalAlignment:VerticalAlignmentTop];
        _contentLb.font = [UIFont systemFontOfSize:14];
    }
    return _contentLb;
}





@end




